<style>
    .header {
        margin: 90rpx 0 90rpx 50rpx;
        border-bottom: 1px solid #ccc;
        text-align: center;
        width: 650rpx;
        height: 300rpx;
        line-height: 450rpx;
    }

    .header image {
        width: 200rpx;
        height: 200rpx;
    }

    .content {
        margin-left: 50rpx;
        margin-bottom: 90rpx;
    }

    .content text {
        display: block;
        color: #9d9d9d;
        margin-top: 40rpx;
    }

    .bottom {
        border-radius: 80rpx;
        margin: 70rpx 50rpx;
        font-size: 35rpx;
    }
</style>	

<template>
    <view>
        <!-- #ifdef MP-WEIXIN -->
        <view>
            <view>
                <view class='header'>
                    登录图片
                </view>
                <view class='content'>
                    <view>申请获取以下权限</view>
                    <text>获得你的公开信息(昵称，头像、地区等)</text>
                </view>
								<button class='bottom' type="primary" open-type="getUserInfo" @getuserinfo="wxGetUserInfo">授权登录</button>
            </view>
        </view>
        <!-- #endif -->
    </view>
</template>


<script>
    export default {
        data() {
            return {
                SessionKey: '',
                OpenId: '',
                nickName: null,
                avatarUrl: null,
                
            };
        },
        methods: {
				  wxGetUserInfo(res){
					 if(res.detail.rawData == undefined){
						 console.log('用户取消了登录');
					 }else{
							uni.showLoading({
									title: '登录中...'
							});
						 uni.login({
							provider: 'weixin',
							success: function (loginRes) {
								console.log('用户登录成功',res);
								console.log(JSON.parse(res.detail.rawData))
								console.log(loginRes,'aaa');
								
								//登录完毕将数据存入本地
								//然后跳转
								uni.hideLoading();
							}
						});
					 }
				  },
        },
        mounted() {
          
        }
    }
</script>
